import 'package:enterprise_v8/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v8/app/data/entities/auth/login_entity.dart';

LoginEntity $LoginEntityFromJson(Map<String, dynamic> json) {
  final LoginEntity loginEntity = LoginEntity();
  final String? accessToken = jsonConvert.convert<String>(json['access_token']);
  if (accessToken != null) {
    loginEntity.accessToken = accessToken;
  }
  final String? tokenType = jsonConvert.convert<String>(json['token_type']);
  if (tokenType != null) {
    loginEntity.tokenType = tokenType;
  }
  final int? expiresIn = jsonConvert.convert<int>(json['expires_in']);
  if (expiresIn != null) {
    loginEntity.expiresIn = expiresIn;
  }
  final String? scope = jsonConvert.convert<String>(json['scope']);
  if (scope != null) {
    loginEntity.scope = scope;
  }
  final LoginSystemUser? systemUser = jsonConvert.convert<LoginSystemUser>(json['systemUser']);
  if (systemUser != null) {
    loginEntity.systemUser = systemUser;
  }
  final String? jti = jsonConvert.convert<String>(json['jti']);
  if (jti != null) {
    loginEntity.jti = jti;
  }
  return loginEntity;
}

Map<String, dynamic> $LoginEntityToJson(LoginEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['access_token'] = entity.accessToken;
  data['token_type'] = entity.tokenType;
  data['expires_in'] = entity.expiresIn;
  data['scope'] = entity.scope;
  data['systemUser'] = entity.systemUser?.toJson();
  data['jti'] = entity.jti;
  return data;
}

extension LoginEntityExtension on LoginEntity {
  LoginEntity copyWith({
    String? accessToken,
    String? tokenType,
    int? expiresIn,
    String? scope,
    LoginSystemUser? systemUser,
    String? jti,
  }) {
    return LoginEntity()
      ..accessToken = accessToken ?? this.accessToken
      ..tokenType = tokenType ?? this.tokenType
      ..expiresIn = expiresIn ?? this.expiresIn
      ..scope = scope ?? this.scope
      ..systemUser = systemUser ?? this.systemUser
      ..jti = jti ?? this.jti;
  }
}

LoginSystemUser $LoginSystemUserFromJson(Map<String, dynamic> json) {
  final LoginSystemUser loginSystemUser = LoginSystemUser();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    loginSystemUser.id = id;
  }
  final String? username = jsonConvert.convert<String>(json['username']);
  if (username != null) {
    loginSystemUser.username = username;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    loginSystemUser.nickname = nickname;
  }
  final String? otherUid = jsonConvert.convert<String>(json['otherUid']);
  if (otherUid != null) {
    loginSystemUser.otherUid = otherUid;
  }
  final String? password = jsonConvert.convert<String>(json['password']);
  if (password != null) {
    loginSystemUser.password = password;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    loginSystemUser.email = email;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    loginSystemUser.mobile = mobile;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    loginSystemUser.status = status;
  }
  final dynamic createTime = json['createTime'];
  if (createTime != null) {
    loginSystemUser.createTime = createTime;
  }
  final dynamic modifyTime = json['modifyTime'];
  if (modifyTime != null) {
    loginSystemUser.modifyTime = modifyTime;
  }
  final String? lastLoginTime = jsonConvert.convert<String>(json['lastLoginTime']);
  if (lastLoginTime != null) {
    loginSystemUser.lastLoginTime = lastLoginTime;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    loginSystemUser.sex = sex;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    loginSystemUser.avatar = avatar;
  }
  final int? isSystem = jsonConvert.convert<int>(json['isSystem']);
  if (isSystem != null) {
    loginSystemUser.isSystem = isSystem;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    loginSystemUser.description = description;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    loginSystemUser.type = type;
  }
  final String? sign = jsonConvert.convert<String>(json['sign']);
  if (sign != null) {
    loginSystemUser.sign = sign;
  }
  final dynamic createDate = json['createDate'];
  if (createDate != null) {
    loginSystemUser.createDate = createDate;
  }
  final dynamic updateDate = json['updateDate'];
  if (updateDate != null) {
    loginSystemUser.updateDate = updateDate;
  }
  final dynamic createBy = json['createBy'];
  if (createBy != null) {
    loginSystemUser.createBy = createBy;
  }
  final dynamic updateBy = json['updateBy'];
  if (updateBy != null) {
    loginSystemUser.updateBy = updateBy;
  }
  final String? departmentId = jsonConvert.convert<String>(json['departmentId']);
  if (departmentId != null) {
    loginSystemUser.departmentId = departmentId;
  }
  final int? isViewAll = jsonConvert.convert<int>(json['isViewAll']);
  if (isViewAll != null) {
    loginSystemUser.isViewAll = isViewAll;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    loginSystemUser.companyCode = companyCode;
  }
  final dynamic areaCode = json['areaCode'];
  if (areaCode != null) {
    loginSystemUser.areaCode = areaCode;
  }
  final dynamic roleId = json['roleId'];
  if (roleId != null) {
    loginSystemUser.roleId = roleId;
  }
  final String? roleName = jsonConvert.convert<String>(json['roleName']);
  if (roleName != null) {
    loginSystemUser.roleName = roleName;
  }
  return loginSystemUser;
}

Map<String, dynamic> $LoginSystemUserToJson(LoginSystemUser entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['username'] = entity.username;
  data['nickname'] = entity.nickname;
  data['otherUid'] = entity.otherUid;
  data['password'] = entity.password;
  data['email'] = entity.email;
  data['mobile'] = entity.mobile;
  data['status'] = entity.status;
  data['createTime'] = entity.createTime;
  data['modifyTime'] = entity.modifyTime;
  data['lastLoginTime'] = entity.lastLoginTime;
  data['sex'] = entity.sex;
  data['avatar'] = entity.avatar;
  data['isSystem'] = entity.isSystem;
  data['description'] = entity.description;
  data['type'] = entity.type;
  data['sign'] = entity.sign;
  data['createDate'] = entity.createDate;
  data['updateDate'] = entity.updateDate;
  data['createBy'] = entity.createBy;
  data['updateBy'] = entity.updateBy;
  data['departmentId'] = entity.departmentId;
  data['isViewAll'] = entity.isViewAll;
  data['companyCode'] = entity.companyCode;
  data['areaCode'] = entity.areaCode;
  data['roleId'] = entity.roleId;
  data['roleName'] = entity.roleName;
  return data;
}

extension LoginSystemUserExtension on LoginSystemUser {
  LoginSystemUser copyWith({
    String? id,
    String? username,
    String? nickname,
    String? otherUid,
    String? password,
    String? email,
    String? mobile,
    int? status,
    dynamic createTime,
    dynamic modifyTime,
    String? lastLoginTime,
    String? sex,
    String? avatar,
    int? isSystem,
    String? description,
    int? type,
    String? sign,
    dynamic createDate,
    dynamic updateDate,
    dynamic createBy,
    dynamic updateBy,
    String? departmentId,
    int? isViewAll,
    String? companyCode,
    dynamic areaCode,
    dynamic roleId,
    String? roleName,
  }) {
    return LoginSystemUser()
      ..id = id ?? this.id
      ..username = username ?? this.username
      ..nickname = nickname ?? this.nickname
      ..otherUid = otherUid ?? this.otherUid
      ..password = password ?? this.password
      ..email = email ?? this.email
      ..mobile = mobile ?? this.mobile
      ..status = status ?? this.status
      ..createTime = createTime ?? this.createTime
      ..modifyTime = modifyTime ?? this.modifyTime
      ..lastLoginTime = lastLoginTime ?? this.lastLoginTime
      ..sex = sex ?? this.sex
      ..avatar = avatar ?? this.avatar
      ..isSystem = isSystem ?? this.isSystem
      ..description = description ?? this.description
      ..type = type ?? this.type
      ..sign = sign ?? this.sign
      ..createDate = createDate ?? this.createDate
      ..updateDate = updateDate ?? this.updateDate
      ..createBy = createBy ?? this.createBy
      ..updateBy = updateBy ?? this.updateBy
      ..departmentId = departmentId ?? this.departmentId
      ..isViewAll = isViewAll ?? this.isViewAll
      ..companyCode = companyCode ?? this.companyCode
      ..areaCode = areaCode ?? this.areaCode
      ..roleId = roleId ?? this.roleId
      ..roleName = roleName ?? this.roleName;
  }
}